package com.czd.support.service;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.czd.base.model.Paginate;
import com.czd.base.service.BaseService;
import com.czd.support.model.Introduction;

/**
 * @Description 企业详情介绍业务逻辑类
 * @Author CaoRen
 * @Date 2015/06/18
 */
@Service
public class IntroductionService extends BaseService<Introduction>{
	
	public Paginate queryForPage(Introduction introduction,String kw){
		introduction.setWhere(" 1=1");
        if(StringUtils.isNotBlank(kw)){
        	introduction.setWhere(introduction.getWhere() + " and (title like '%"+kw+"%')");
        }
		return this.queryForPaginate(sqlId("queryForPage"), introduction);
	}
	
	public boolean insert(Introduction introduction){
		return this.insert(sqlId("insert"), introduction);
	}
	
	public Introduction findById(int id){
		return this.selectOne(sqlId("findById"), id);
	}
	
	public Boolean update(Introduction introduction){
		return this.update(sqlId("update"), introduction);
	}
	
	public Boolean delete(int id){
		return this.delete(sqlId("delete"), id);
	}
}
